package com.collect.zambia.zhiScene.zhiRemind.zhiCustomer.zhiMember.zhiPerformance.zhiSort;

import com.collect.zambia.zhiBean.zhiReceive.ZHIRCustomerPerformanceEntity;
import com.collect.zambia.zhiUtils.ZHICalendarUtil;

import java.util.Comparator;

public class ZHICustomerPerformanceCompare {

    public static class ZHICustomerPerformanceCompareByAssignDateASC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getAssignDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getAssignDate() + " 00:00:00", null);

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHICustomerPerformanceCompareByAssignDateDESC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getAssignDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getAssignDate() + " 00:00:00", null);

            return Long.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHICustomerPerformanceCompareByRepayDateASC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getRepayDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getRepayDate() + " 00:00:00", null);

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHICustomerPerformanceCompareByRepayDateDESC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            long o1DateL = ZHICalendarUtil.getTimeFromDateString(o1.getRepayDate() + " 00:00:00", null);
            long o2DateL = ZHICalendarUtil.getTimeFromDateString(o2.getRepayDate() + " 00:00:00", null);

            return Long.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHICustomerPerformanceCompareByAssignNumASC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            int o1DateL = o1.getAssignNumFormatInt();
            int o2DateL = o2.getAssignNumFormatInt();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHICustomerPerformanceCompareByAssignNumDESC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            int o1DateL = o1.getAssignNumFormatInt();
            int o2DateL = o2.getAssignNumFormatInt();

            return Integer.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHICustomerPerformanceCompareBySettleNumASC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            int o1DateL = o1.getRepayNumFormatInt();
            int o2DateL = o2.getRepayNumFormatInt();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHICustomerPerformanceCompareBySettleNumDESC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            int o1DateL = o1.getRepayNumFormatInt();
            int o2DateL = o2.getRepayNumFormatInt();

            return Integer.compare(o2DateL, o1DateL);
        }
    }

    public static class ZHICustomerPerformanceCompareBySettleRateASC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            float o1DateL = o1.getRepayRateFormatFloat();
            float o2DateL = o2.getRepayRateFormatFloat();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHICustomerPerformanceCompareBySettleRateDESC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            float o1DateL = o1.getRepayRateFormatFloat();
            float o2DateL = o2.getRepayRateFormatFloat();

            return Float.compare(o2DateL, o1DateL);
        }
    }


    public static class ZHICustomerPerformanceCompareByBounsASC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            float o1DateL = o1.getBonusFormatFloat();
            float o2DateL = o2.getBonusFormatFloat();

            if (o1DateL < o2DateL) {
                return -1;
            } else if (o1DateL < o2DateL) {
                return 0;
            } else {
                return 1;
            }
        }
    }

    public static class ZHICustomerPerformanceCompareByBounsDESC implements Comparator<ZHIRCustomerPerformanceEntity> {
        @Override
        public int compare(ZHIRCustomerPerformanceEntity o1, ZHIRCustomerPerformanceEntity o2) {

            float o1DateL = o1.getBonusFormatFloat();
            float o2DateL = o2.getBonusFormatFloat();

            return Float.compare(o2DateL, o1DateL);
        }
    }
}
